package com.yun.util.yun.ip;


import org.junit.Test;

import java.util.HashMap;

import static org.junit.Assert.assertEquals;

public class L34IP_LOCALTest {

    @Test
    public void test112221333() throws Exception {
        compare("2409:8080:801::8:0 112",
                "2409:8080:801::8:: 112");
    }

    @Test
    public void test11222133() throws Exception {
        compare("2409:8080:0801:0000::8:0000/112",
                "2409:8080:801::8:: 112");
    }



    @Test
    public void test1122213() throws Exception {
        compare("2409:8C34:22A0:7:0000:0000:0000:0000/121",
                "2409:8C34:22A0:7::  121");
    }

    @Test
    public void test112213() throws Exception {
        compare("2409:8C50:0A00:2023:0000:0000:0000:0000/64",
                "2409:8C50:A00:2023::  64");
    }

    @Test
    public void test11213() throws Exception {
        compare("2409:8c28:202:c:0:1:0:0/96",
                "2409:8c28:202:c: :1: : 96");
    }

    @Test
    public void test11212() throws Exception {
        compare("2409:8c44:6400:0000::6f06:2000/120",
                "2409:8c44:6400:     :6f06:2000 120");
    }

    @Test
    public void test1() throws Exception {
        compare("2409:801a:3006:3:4:1:0:3ef 128",
                "2409:801a:3006:3:4:1: :3ef 128");
    }

    @Test
    public void testN() throws Exception {
        compare("2409:801a:3006:0:0:0:0:3ef 128",
                "2409:801a:3006:       :3ef 128");
    }

    @Test
    public void test2323() throws Exception {
        compare("2409:801a:3006:3:0004:01:012:03ef 128",
                "2409:801a:3006:3:   4: 1: 12: 3ef 128");
    }

    private void compare(String original, String expect) {
        System.out.println(original);
        HashMap<String, String> arg2 = new HashMap<>();
        arg2.put("THREEIP", original);
        String arg3 = "";
        L34IP_LOCAL l34IP_local = new L34IP_LOCAL();
        String[] values = l34IP_local.getValues(arg2, arg3);
        assertEquals(expect.replace(" ", ""), values[0].replace(" ", ""));
    }

}
